import { Directive, ViewContainerRef, TemplateRef,Input, ComponentRef } from '@angular/core';

@Directive({
  selector: '[appShowList]'
})
export class ShowListDirective {

  constructor(private viewContainer: ViewContainerRef, private templateRef: TemplateRef<any>) { }

  @Input() appShowList: string[] = [];

  ngOnInit(){
    // for(let i=0;i<this.appShowList.length;i++){
    //   this.viewContainer.createEmbeddedView(this.templateRef, { item: this.appShowList[i]})
    // }
    for(let i=0;i<this.appShowList.length;i++){
      this.viewContainer.createEmbeddedView(this.templateRef, { $implicit: this.appShowList[i]})
    }
  }

}
